<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>给组件绑定原生事件</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="root">
        <!-- @click.native父组件可以之间使用原生的事件 -->
        <child @click.native="handleClick"></child>
    </div>
    <script>
        Vue.component('child', {
            template: '<div>Child</div>'
            //原生事件
            // template: '<div @click="handleChildClick">Child</div>',
            // methods: {
            //     handleChildClick: function(){
            //         alert('child click');
            //         this.$emit('click');// 子组件向外传递事件click能让父组件触发
            //     }
            // }
        })
        var vm = new Vue({
            el: "#root",
            methods: {
                handleClick: function(){
                    alert('click');
                }
            }
        });
    </script>
</body>
</html>